<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>检查数组是否经排序和轮转得到</title>
</head>
<body>
  <script>
    function fn(nums) {
      return nums.concat(nums).join().includes(nums.sort((a, b) => a - b).join())
    }
    console.log(fn([3, 4, 5, 1, 2]))
  </script>
</body>
</html>